﻿@model Models.Models.Domain
@using WebApp.Classes

@using (Ajax.BeginForm(Model.ID == 0 ? "CreateDomain" : "EditDomain", "Domain", null, new AjaxOptions(), new { @id = "formDomain", @class = "form-horizontal" }))
{        
        <fieldset style="height: 440px; border-style: ridge; border-width: 1px; border-color: #DDDDDD;">
                @Html.ValidationSummary()

                @Html.HiddenFor(model => model.ID)
                @Html.HiddenFor(model => model.StoreID)

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.IPAddress)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.IPAddress, new { @class = "input-medium" })</div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.Name)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.Name, new { @class = "input-medium" })</div>
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.TimerValue1)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.TimerValue1, new { @class = "input-small" }) seconds</div>
                    
                </div>

                <div class="control-group">    
                    <label class="control-label" for="input01">@Html.LabelFor(m => m.TimerValue2)</label>
                    <div class="controls">@Html.TextBoxFor(m => m.TimerValue2, new { @class = "input-small" }) seconds</div>
                </div>

        </fieldset>            
        <br />
    
    {
        var rights = new WebApp.Classes.UserRights("Domain Management");

        if (rights.FullControl || rights.Editable)
        { 
                    <div class="">
                        @if (!Model.RevokeStatus)
                        {
                            if (Model.ID == 0)
                            {
                                <button type="submit" class="btn btn-inverse" id="createDomain"><i class="icon-ok icon-white"></i> Create</button>            
                            }
                            else
                            { 
                                <button type="submit" class="btn btn-inverse" id="updateDomain"><i class="icon-ok icon-white"></i> Update</button>                                        
                            }
                        }
                        @if (Model.ID != 0)
                        {
                            if (Model.RevokeStatus)
                            {
                                <button type="button" class="btn btn-inverse" id="activate"><i class="icon-repeat icon-white"></i> Activate</button>
                            }
                            else
                            {                            
                                <button type="button" class="btn btn-inverse" id="revoke"><i class="icon-remove icon-white"></i> Revoke</button>
                            }
                        }
                    </div>
                    }
                }

}